using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Windows.Forms;

namespace CursorProject
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                DirectoryInfo dir = new
                    DirectoryInfo(@"C:\WINDOWS\");
                int i = 1; ListViewItem item1;
                int max = dir.GetFiles("*.*").Length;
                progressBar1.Maximum = max;
                foreach (FileInfo d in dir.GetFiles("*.*"))
                {                    
                    progressBar1.Value = i;                    
                    item1 = new ListViewItem(d.Name);
                    item1.SubItems.Add(d.Length.ToString());
                    item1.SubItems.Add(d.CreationTime.ToLongDateString());
                    lvData.Items.Add(item1);
                    i++;
                    Application.DoEvents();
                }
                this.Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            lvData.Columns.Add("Name", 100, 0);
            lvData.Columns.Add("Size", 50, 0);
            lvData.Columns.Add("Date", 70, 0);
            lvData.View = View.Details;
        }

        
    }
}